package bill.study.concurrency.collections;

import java.util.concurrent.CopyOnWriteArraySet;

public class ConcurrentCollectionExample {
	private final CopyOnWriteArraySet<Handler> handlers = new CopyOnWriteArraySet<Handler>();

	public void addHandler(Handler h) {
		handlers.add(h);
	}

	private long internalState;

	private synchronized void changeState() {
	}

	public void update() {
		changeState();
		for (Handler handler : handlers)
			handler.handle();
	}
}

interface Handler {
	void handle();
}




